#ifndef _GUI_H
#define _GUI_H

#include <graphics.h>
#include <windows.h>
#include <shlobj.h>
#include <tchar.h>
#include <string>
#include <algorithm>

#include "Packet.h"
//#include <stdio.h>
//#include <string.h>

#pragma comment(lib, "shell32.lib")
#pragma comment(lib, "ole32.lib")

#define BTN_WIDTH 120
#define BTN_HEIGHT 30
#define MARGIN 20
#define COLUMN_SPACE 150
#define MIDDLE (CenterX - BTN_WIDTH/2)
#define CenterX (getwidth() / 2)

#define centerX(width) (getwidth() - width)/2 	//; 
#define Wfclose_all(s)	fclose(input), fclose(output), wprintf(L": %s\n", s);	//;
#define fileW_open(s1,s2,s3)  FILE *s1 = _wfopen(s2, s3); \
	if (!s1) perror("输入文件打开失败");

/*基于需求，启用 #pragma pack()
*/
//#pragma pack(1)
//按钮结构体
struct Button
{
	int x, y;
	const char* text;
	int pressed;
};
// 密码输入窗口结构体
struct PasswordWindow
{
	int x, y;
	char input[64];     // 输入缓冲区
	int cursorPos;
	bool active;
	bool confirm;
};
//#pragma pack()

//kernel
void GUI_run();
// 选择目录函数
void SelectDirectory(wchar_t* selectedPath);
// 创建帮助窗口
void ShowHelpWindow();
// 绘制按钮
void DrawButton(Button btn);
//加/解密窗口
void DrawPasswordWindow(PasswordWindow& pw);
PasswordWindow CreatePasswordWindow(int width, int height);
bool ProcessPasswordWindow(PasswordWindow& pw);

// 功能接口声明API
void Pack(wchar_t* path,const char*);
void Unpack(wchar_t* path,const char*);
void Compress(wchar_t* path,const char*);
void Uncompress(wchar_t* path,const char*);
void Encrypt(wchar_t* path,const char*);
void Decrypt(wchar_t* path,const char*);

#endif /*_GUI_H*/
